import 'package:flutter/material.dart';

import 'pages/tab/TabList.dart';
import 'routers/routers.dart';
import 'package:flutter_localizations/flutter_localizations.dart';
import 'package:flutter_downloader/flutter_downloader.dart';

void main() => runApp(MyApp());

void initDownloader() async {
  WidgetsFlutterBinding.ensureInitialized();
// Plugin must be initialized before using
  await FlutterDownloader.initialize(debug: true, ignoreSsl: true);
}

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    initDownloader();
    return MaterialApp(
      debugShowCheckedModeBanner: false,
      theme: ThemeData(
          appBarTheme: const AppBarTheme(
        centerTitle: true,
        backgroundColor: Colors.blue,
        titleTextStyle: TextStyle(
          color: Colors.white,
          fontSize: 18,
          fontWeight: FontWeight.bold,
        ),
        iconTheme: IconThemeData(
          color: Colors.white,
        ),
      )),
      home: TabList(),
      initialRoute: "/",
      onGenerateRoute: onGenerateRoute,
      localizationsDelegates: const [
        GlobalMaterialLocalizations.delegate,
        GlobalWidgetsLocalizations.delegate,
        GlobalCupertinoLocalizations.delegate,
      ],
      supportedLocales: const [
        Locale('zh', 'CH'),
        Locale('en', 'US'),
      ],
    );
  }
}
